package com.ithiema.controller;

import com.ithiema.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Value("${name}")
    private String name;

    @Value("${person.name}")
    private String name2;

    @Value("${address[0]}")
    private String address;

    @Autowired
    private Environment env;

    @Autowired
    private HelloService helloService;

    @RequestMapping("/hello")
    public void Test(){
        helloService.Add();
    }

    @RequestMapping("/hello1")
    public void Test1(){
        System.out.println(env.getProperty("name"));
    }

    @RequestMapping("/hello2")
    public void Test2(){
        System.out.println(name);
    }
}
